package com.qf.mappers;

import com.qf.pojo.Device;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/*
杨威
2022/1/5
13:25
*/
public interface DeviceMapper {
    @Insert("insert into sys_device(device_id,device_name,categy_id,bind_user_id,scene_id,bind_time,is_online)values(#{deviceId},#{deviceName},#{categyId},#{bindUserId},#{sceneId},#{bindTime},#{isOnline})")
    void addDevice(Device device);
    @Select("select * from sys_device where device_id=#{deviceId}")
    Device selectByDeviceId(String deviceId);
    @Update("UPDATE sys_device SET is_online=#{isOnline},connect_time=#{connectTime},current_connect_ip=#{currentConnectIp} ,connect_location=#{connectLocation} WHERE device_id =#{deviceId}")
    void updateOnLine(Device device);
    @Update("UPDATE sys_device SET is_online=#{isOnline},lost_connect_time=#{lostConnectTime} WHERE device_id =#{deviceId}")
    void updateOffLine(Device device);
}
